<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC>
<html>
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <title>hap_result.jsp</title>
     <link rel="stylesheet" type="text/css" href="./css/main.css"/>
</head>
<body>
     <%
          int x = Integer.parseInt(request.getParameter("x"));
          int y = Integer.parseInt(request.getParameter("y"));
     %>
     
     <%!
     
     public int sum(int x, int y){
          int hap = 0;
          for(int i=x; i<=y; i++){
               hap += i;
     }
          return hap;
          };
     
     
     public double avg(int x, int y){
          double j = 0;
          j = (double)sum(x,y)/(y-x+1);
          return j;     
     }
          
     %>
          
     <div class='title_js'>hap result</div>
     <u1>
          <li>x값 : <%=x %></li>
          <li>y값 : <%=y %></li>
          <li>두 수의 합 : <%=sum(x, y) %> </li>
          <li>두 수의 평균 : <%=avg(x, y) %> </li>          
     </u1>          

<a href='Main.jsp?inc=./jsp/hap.jsp'>재 입력</a>

<input type='reset' value='재입력'
     onclick="location.href='Main.jsp?inc=./jsp/hap.jsp'"/>

</body>
</html>